
import React from 'react';
import './main.scss';
import { api } from 'js/api/api';
import Button from 'views/component/button/button';


class Main extends React.Component {
    close = () => {
        this.props.close();
    }
    addGold = () => {
        api('addGold', () => {

        })
    }
    addItem = () => {
        console.log(this.refs.item.value)
        let value = this.refs.item.value;
        if (!Number.isNaN(value)) {
            api('addItem', { itemId: parseInt(value) }, () => {

            })
        }
    }
    render() {
        return <div>
            <Button onClick={this.close}>关闭</Button>
            <Button onClick={this.addGold}>添加金币</Button><Button>提升等级</Button>
            <input ref="item" />
            <Button onClick={this.addItem}>添加物品</Button>
        </div>
    }
}

export default Main;